<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/11/6
 * Time: 10:37
 */

namespace app\api\controller;


use cmf\controller\HomeBaseController;
use think\Db;

/**
 * Class QuestionController
 * @package app\api\controller
 * 小合在线
 */
class QuestionController extends HomeBaseController
{

    /**
     * 问题提交
     * nick   姓名
     * phone  手机号
     * content  问题
     * url       url
     */
    public function problem_commit()
    {
        $data = request()->param();
        $data['date'] = date('Y-m-d H:i:s');
        $data['create_time'] = date('Y-m-d H:i:s');
        $data['adder'] = getArea(getip());
        $res = Db::name('lands')->insert($data);
        if($res){
            return_json(1,'提交成功');
        }else{
            return_json(0,'提交失败');
        }
    }

    /**
     * @return \think\response\Json
     * @throws \think\exception\DbException
     * number  每页条数
     * 列表
     */
    public function problem_list()
    {
        $number = request()->param('number');
        $list = Db::name('lands')->where('status',2)->order('update_time desc')->paginate($number);

        return_json(1,'获取数据成功',$list);
    }

}